<template>
	<view class="com-b">
		<view class="title">
			子组件B
		</view>
		<view class="value">
			CompA组件传进来的值：<text style="color: blue;">{{result}}</text>
		</view>
		<view class="result">
			回传值：<input  type="text" v-model="callbackValue" style="background-color: gray; color: yellow;" /><button @click="sendOutside()">回传</button>
		</view>
		
	</view>
</template>

<script>
	export default {
		name:"comB",
		props:{
			
		},
		data() {
			return {
				callbackValue:"",
				result:""
			};
		},
		methods:{
			sendOutside(){
				this.$emit('callBackFun',this.callbackValue);
			}
		},
		created() {
			uni.$on('getIntent',(msg)=>{
				console.log(msg);
				this.result = msg;
			})
		}
	}
</script>

<style>
.com-b{
	width: 90%;
	background-color: #03eb00;
	padding-top: 20rpx;
	padding-bottom: 20rpx;
	margin-top: 20rpx;
}

.title{
	width: 100%;
	display: flex;
	justify-content: center;
	font-weight: bold;
	margin-bottom: 20rpx;
}
.value{
	margin-bottom: 20rpx;
}
.result{
	display: flex;
	justify-content: center;
	align-items: center;
}
.result>button{

}
</style>